import { size } from 'lodash'
import { Color } from '@/utils/types'
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { historyLamp } from '@/utils/config'

export const useHistoryRef = () => {
  return ref(historyLamp)
}

const useColorStore = defineStore('color', () => {
  const value = ref(0)
  const step = ref(0)
  const current = ref<Color>('')
  const historys = ref(historyLamp)
  const push = () => {
    historys.value.pop()
    historys.value.unshift(current.value)
  }
  return { 
    step,
    push,
    value,
    current,
    historys 
  }
})

export default useColorStore
